import bus from '@/bus'
import { renderButton } from '@/util'
let data = {
  status: 'pass',
  totalItem: 1,
  pageSize: window.$pageSize,
  currentPage: 1,
  form: {
  },
  isIntegralRight: false,
  isRebateRight: false,
  columns: [{
    type: 'selection',
    width: 60,
    align: 'left',
    fixed: 'left'
  }, {
    title: '星标',
    key: 'code',
    align: 'left',
    minWidth: 80,
    render: (h, params) => {
      return h('Icon', {
        class: params.row.isStar ? 'ivu-icon ivu-icon-md-star' : 'ivu-icon ivu-icon-md-star-outline',
        style: { fontSize: '24px', cursor: 'pointer' },
        on: {
          'click': () => {
            bus.$emit('changeStar', params.row)
          }
        }
      })
    }
  }, {
    title: '门店名称',
    key: 'storeName',
    minWidth: 180
  }, {
    title: '店主姓名',
    key: 'ownerName',
    align: 'left',
    minWidth: 130
  }, {
    title: '经销商',
    key: 'distributorName',
    align: 'left',
    minWidth: 200,
    render: (h, p) => {
      return <div class="e1" title={p.row.distributorName}>{p.row.distributorName}</div>
    }
  }, {
    title: '品牌',
    key: 'brandName',
    align: 'left',
    minWidth: 200,
    render(h, p) {
      let storeContractBrandDTOList = p.row.storeContractBrandDTOList || []
      let text = storeContractBrandDTOList.map(item => item.brandName).join(' / ')
      return <div class="e1" title={text}>{text}</div>
    }
  }, {
    title: '门店维护人',
    key: 'salesmanName',
    align: 'left',
    minWidth: 120
  }, {
    title: '门店类型',
    key: 'storeTypeName',
    align: 'left',
    minWidth: 100
  }, {
    title: '门店任务量',
    key: 'storeTaskQuantity',
    align: 'right',
    minWidth: 120
  }, {
    title: '科室',
    key: 'officeName',
    align: 'left',
    minWidth: 100
  }, {
    title: '部门',
    key: 'depName',
    align: 'left',
    minWidth: 150
  }, {
    title: '签约身份证',
    key: 'ownerIdcardNo',
    align: 'left',
    minWidth: 200
  }, {
    title: '营业执照',
    key: 'businessLicenseNo',
    align: 'left',
    minWidth: 150
  }, {
    title: '签约手机号',
    key: 'storePhone',
    align: 'left',
    minWidth: 150
  }, {
    title: '签约状态',
    key: 'contractStatusStr',
    align: 'left',
    minWidth: 120
  }, {
    title: '签约来源',
    key: 'signSourceStr',
    align: 'left',
    minWidth: 120
  }, {
    title: '审核状态',
    key: 'auditStatusStr',
    align: 'left',
    minWidth: 120
  }, {
    title: '扩展字段1',
    key: 'a',
    align: 'left',
    minWidth: 150,
    render (h, p) {
      const storeContractSourceDTOList = p.row.storeContractSourceDTOList || []
      const result = storeContractSourceDTOList.find(item => item.sourceKey === 'brandId')
      return result ? <span>{ result.sourceStrValue }</span> : <span>-</span>
    }
  }, {
    title: '扩展字段2',
    key: 'b',
    align: 'left',
    minWidth: 150,
    render (h, p) {
      const storeContractSourceDTOList = p.row.storeContractSourceDTOList || []
      const result = storeContractSourceDTOList.find(item => item.sourceKey === 'storeTypeId')
      return result ? <span>{ result.sourceStrValue }</span> : <span>-</span>
    }
  }, {
    title: '扩展字段3',
    key: 'c',
    align: 'left',
    minWidth: 200,
    render (h, p) {
      const storeContractSourceDTOList = p.row.storeContractSourceDTOList || []
      const result = storeContractSourceDTOList.find(item => item.sourceKey === 'distributorId')
      return result ? <div class="e1" title={ result.sourceStrValue }>{ result.sourceStrValue }</div> : <span>-</span>
    }
  }, {
    title: '合同状态',
    key: 'storeContractAgreementDTO',
    align: 'left',
    minWidth: 120,
    render: (h, params) => {
      let str = '未签约'
      if (params.row.storeContractAgreementDTO && params.row.storeContractAgreementDTO.isEnable) {
        str = '已签约'
      }
      return <div>{str}</div>
    }
  }, {
    title: '操作',
    align: 'right',
    minWidth: 200,
    fixed: 'right',
    render: (h, params) => {
      return (
        <div>
          { renderButton(h, { text: '查看' }, () => { bus.$emit('detailRow', params.row) })}
          { renderButton(h, { text: '编辑', type: 'primary' }, () => { bus.$emit('editRow', params.row) })}
          <dropdown class='more-button-inDropdown ml5' v-show={params.row.isIntegralRight || params.row.isRebateRight} transfer={true}>
            <i-button size='small' type='primary'>
                更多
              <icon type='ios-arrow-down'></icon>
            </i-button>
            <dropdownMenu slot='list'>
              <dropdownItem v-show={params.row.isIntegralRight}>
                { renderButton(h, { text: '积分奖惩', type: 'warning' }, () => { bus.$emit('pointEdit', { row: params.row }) })}
              </dropdownItem>
              <dropdownItem v-show={params.row.isRebateRight}>
                { renderButton(h, { text: '返利奖惩', type: 'primary' }, () => { bus.$emit('rebateEdit', { row: params.row }) })}
              </dropdownItem>
            </dropdownMenu>
          </dropdown>
        </div>
      )
    }
  }],
  data: [{ isstar: false }]
}
export default data
